package controller

import (
	"mbti/model"

	"github.com/gin-gonic/gin"
)

//学生注册
func ResgiterStudent(ctx *gin.Context) {

	class := ctx.PostForm("studentClass")
	specialize := ctx.PostForm("specialize")
	college := ctx.PostForm("college")
	name := ctx.PostForm("studentName")
	studentID := ctx.PostForm("studentID")

	isOk := model.InsertUser(studentID, name, college, specialize, class)
	if isOk == false {
		ctx.JSON(422, gin.H{
			"code": 422,
			"msg":  "注册失败,该用户已存在",
		})
		return
	}
	ctx.JSON(200, gin.H{
		"code": 200,
		"msg":  "注册成功",
	})

}
